﻿namespace LinkedTU.Models
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel.DataAnnotations;
    using System.ComponentModel.DataAnnotations.Schema;
    using LinkedTU.Common.Constants;

    public class Course : BaseDbEntity
    {
        private ICollection<TakenCourse> takenCourseInstances;

        public Course()
        {
            this.takenCourseInstances = new HashSet<TakenCourse>();
        }

        public int CourseId { get; set; }

        [Required]
        [MinLength(ValidationConstants.MinCourseTitleLength)]
        [MaxLength(ValidationConstants.MaxCourseTitleLength)]
        public string Title { get; set; }

        [MinLength(ValidationConstants.MinCourseDescriptionLength)]
        [MaxLength(ValidationConstants.MaxCourseDescriptionLength)]
        public string Description { get; set; }

        public virtual ApplicationUser LeadProfessor { get; set; }

        public int? CopanyOrUniversityId { get; set; }

        public virtual Company CompanyOrUniversity { get; set; }

        public virtual ICollection<TakenCourse> TakenCourseInstances
        {
            get { return this.takenCourseInstances; }
            set { this.takenCourseInstances = value; }
        }
    }
}
